package ftp;

import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class FtpServer {
	public static void main(String[] args) throws Exception{
		ServerSocket server=new ServerSocket(8888);
		Socket socket=server.accept();
		InputStream is=new FileInputStream("home/a.txt");
		OutputStream os=socket.getOutputStream();
		byte[] buffer=new byte[256];
		int len=0;
		while((len=is.read(buffer))!=-1){
			os.write(buffer, 0, len);
		}
		os.close();
		is.close();
		socket.close();
		server.close();
		
	}
}
